The present invention relates to file systems for computers and to a method of synchronising a set of named target files with a set of named source files.
All modern computers employ a file system as a part of their operating system. A principal task of the file system is to enable a user to create a logical structure of files of data and to manage the secondary storage of. this data onto disk or tape, controlling its retrieval and security. To do this, it is usual for the system to create a structured directory, also on secondary storage, in which entries identify the file by name and some of its properties and also include a logical pointer to data storage areas in which, for example, fixed size blocks may be chained together by pointers.
Every user of a personal computer is familiar with the hierarchical appearance of his or her own file structure in which large numbers of subdirectories may be created, each containing a potentially quite large number of files. At times it is desirable to add modify or delete information and to move the changed information to different subdirectories (sometimes called folders) or even to other file systems (such as between a hard disk and a network server). Typical operations allowed by the operating system include:
Createxe2x80x94which creates an entry for a provided file name in the directory;
Deletexe2x80x94which deletes an existing directory entry and releases the corresponding secondary storage;
Renamexe2x80x94which renames an existing file in the directory;
Copyxe2x80x94which copies a file to another subdirectory or file system, leaving the original;
Movexe2x80x94which moves the file without leaving the original and
Listxe2x80x94which lists files with specified properties or attributes in response to a query command
Other common operations such as Open, Close, Read and Write are not relevant to the present invention.
At a somewhat broader level than the personal computer file system, library systems also exist with similar logical structures and operations. One application of a library system is to hold the source code modules created and modified during the development of a computer program in a structured library and to provide current sets of these modules to a build process so that an executable version of the current level of program can be compiled, link edited and tested. Another similar arrangement is an install suite of executable and associated files of a software package which provides the complete set of files necessary to run and administer that package. When components are replaced or updated, a new install suite must be created on the user""s system to replace the original. All these systems are intended to be included within the scope of the broad term xe2x80x9cfile systemxe2x80x9d as used herein.
In general, in all these cases, there is a problem of maintaining synchronisation between two sets of files: a set of source files and a set of target files. The trivial solution is to delete all the files from the target and copy all the files from the source set. This is reliable but can take a great deal of time if the source set is very large.
An alternative is to try to identify only the changes that have taken place on the source set and to make the same changes to the target set. It is a relatively simple matter to identify the new files and files whose contents have been changed by examining a modification date (or timestamp) associated with the file and to copy these new or changed files to the target file set.
Various comparison methods for determining which of a set of source files has changed and must be copied to a target set are shown in published patent applications EP 0230616 A2 and EP 0841615 A2 and in U.S. Pat. No. 4,912,637, 5,278,979 and 5,771,381. The applications described in these patents are to version control of source code, software package updating and computer system configuration control.
However, the latter method will not work for files which have been deleted from the source file set which will remain on the target copy. Only by replacing all files or at least listing them all so as to determine which have been deleted, can deleted files at source be removed from the target set.
The continued presence of files which should have been deleted can cause problems. For example in the source code version control case, when the executable code is compiled, it is important that source parts which reference a deleted file should fail to compile so that these references can be detected and deleted by the code developers. If the item is left in the build target file set (or xe2x80x9cshadowxe2x80x9d), then the executable code might build without errors but would not accurately reflect the status of the source library file set. Detection of parts which are no longer present is not easy. It relies on the deletion being recorded and the record of it being accessible to the process that maintains the shadowing. In view of the xe2x80x9cundoxe2x80x9d capability for a library system command, an accurate determination of the status of such records is invariably complex.
Presently available file and library""systems do not have the ability to easily handle deleted files so that copies are automatically deleted.
Accordingly, the present invention provides a file system for a computer comprising non-volatile storage for storing a plurality of directories, each for maintaining at least one list of data files as a plurality of directory entries; first means for creating data file directory entries, each of which includes a file name, file attributes and a pointer to the location of said file data in storage; second means for creating anti-file directory entries, each of which includes a file name and also a file attribute indicating there is no real data file corresponding to the directory entry; means for moving entries between directories; means for comparing data file and anti-file names in said directory entries within a directory; and means responsive to an equal compare by said comparing means to delete the directory entry for the respective real data file, thereby releasing the corresponding location in storage.
According to another aspect, the invention also provides a file handling computer program capable of supporting a plurality of directories, each for maintaining at least one list of data files in non-volatile storage as a plurality of directory entries; said computer program comprising: first means for creating data file directory entries, each of which includes a file name, file attributes and a pointer to the location of said file data in storage; second means for creating anti-file directory entries, each of which includes a file name and also a file attribute indicating there is no real data file corresponding to the directory entry; means for moving entries between directories; means for comparing data file and anti-file names in said directory entries within a directory; and means responsive to an equal compare by said comparing means to delete the directory entry for the respective real data file, thereby releasing the corresponding location in storage.
In such a system, anti-files can either be created directly in the system as the result of a create anti-file command or they can be created as a result of a command to delete an existing real data file. In the latter case, the invention also provides a method of synchronising in a computer system a set of named target files, listed as entries in a target directory, with a set of named source files containing data, listed as entries in a source directory, the source files being subject to change in response to respective external commands to create new source data files and to delete and to modify existing source data files, the method comprising the steps of: in response to an external command to delete-a source data file, deleting the corresponding source directory entry and creating an anti-file directory entry, being an entry with the same name but having an additional attribute indicating there is no real data file corresponding to the anti-file directory entry; copying all changed source data file directory entries to the target directory so as to replace any like named target directory entries with the copied directory entries; and deleting from the target directory any real data file entry having an anti-file of the same name.
This permits copies of directories to be synchronised in file systems, generally including library systems for source code control and application package install suites. The changed files are preferably identified by some sort of currency information such as a timestamp or version number.
Although anti-file directory entries will preferably delete the correspondingly named real file entries in the target directory as a result of being copied, it would be possible for them to be processed within the source file system which could replace the copy command to the target directory with a delete command, directed at the target file.
The question arises as to what should happen to the anti-file entry after being copied to the target directory . One simple possibility is that the anti-file entry should also be deleted. However, it is also possible that the anti-file entry could include a count attribute which, if non-zero would allow the anti-file entry to remain in the target directory, being decremented whenever a further real file entry of the same name was copied into the directory. Eventually, the anti-file directory entry would be deleted when the count attribute reached zero.
Another use of a persistent anti-file entry with a count attribute is where the target directory is only a buffer and synchronisation with a further directory is required in which the anti-file entry can play the same role of deleting real file entries which no longer exist in the source directory.
Although the invention is described as implemented in a single platform, it can also be applied across multiple platforms provided the file system on each platform is a system according to the invention, capable of handling anti-files, and that the data interchange between platforms correctly communicates the anti-file attributes.